package com.itlong.cloud.sdk.service.impl;

import com.itlong.cloud.POJO.VO.sdk.old.SDKAppOldElevatorInfoVO;
import com.itlong.cloud.sdk.dao.ISDKAppOldElevatorDao;
import com.itlong.cloud.sdk.service.ISDKAppOldElevatorInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;

/**
* <desc>
*    旧版APP_SDK电梯设备服务接口实现..
* </desc>
*
* @createDate 2017-11-16
*/
@Service
public class SDKAppOldElevatorInfoServiceImpl implements ISDKAppOldElevatorInfoService {


    @Autowired
    ISDKAppOldElevatorDao isdkAppOldElevatorDao; //旧版SDK_APP电梯设备数据访问接口.

    /**
     * <desc>
     * 根据地址获取电梯设备唯一码列表.
     * </desc>
     *
     * @param projectId 项目编号
     * @param buildNum  楼栋编号
     * @param unitNums  单元编号列表(逗号分隔)
     * @return 设备唯一码列表
     * @author LewisLouis
     * @createDate 2017-11-16
     */
    @Override
    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
    public List<SDKAppOldElevatorInfoVO> getDeviceUniquesByAddress(String projectId, String buildNum, String unitNums) {
        List<String> unitNumList = Arrays.asList(unitNums.split(","));
        return isdkAppOldElevatorDao.getDeviceUniquesByAddress(projectId,buildNum,unitNumList);
    }
}
